package com.feishi.core.util.common;

import java.io.IOException;
import java.net.Socket;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: caixq
 * Date: 2019-04-23
 * Time: 上午11:46
 */
public class TcpReader {
    public static void main(String[] args) throws IOException {
        Socket socket=new Socket("192.168.13.178",4001);
        socket.getInputStream();
        ByteUtil.readBytes(socket.getInputStream(),out->{
            System.out.print("-");
            if(!"080000040D0000000000000000".equals(ByteUtil.getHexString((byte[]) out))){
                System.out.println();
                System.out.println(ByteUtil.getHexString((byte[]) out));
                try {
                    byte[] bs = (byte[]) out;
                    bs[1]=1;
                    socket.getOutputStream().write(bs);
                    socket.getOutputStream().flush();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        });
    }
}
